<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./js/jquery-1.12.4.min.js"></script>
    <script>
        $(function () {
            var href = $(".a1").prop("href");
            console.log("href =" + href);
            $(".a1").prop({ "href": "http://www.baidu.com", "target": "_blank" });



            var mydate = $(".a1").prop("mydate");
            console.log("mydate =" + mydate);//mydate =undefined  获取不到自定义的属性

            

            var mydate1 = $(".a1").attr("mydate");
            console.log("mydate1 =" + mydate1);//mydate1 =haha 可以获取自定义的属性
            var href1 = $(".a1").attr("href");
            console.log("href1 =" + href1);//href1 =http://www.baidu.com 也可以获取自己的属性
        });
    </script>
</head>

<body>

    <a href="" class="a1" mydate="haha">哈哈哈</a>

</body>

</html>